package com.xnyzc.lhy.common.util;


import com.xnyzc.lhy.common.constant.EXieChengResponseConstant;
import lombok.Data;

@Data
public class XieChengResponse {
    private String msgCode;//响应码	OK	响应码
    private String message;//响应详情	成功	响应码

    public void wrap(EXieChengResponseConstant constant) {
        msgCode = constant.getCode();
        message = constant.getDesc();
    }

    public static final XieChengResponse succ() {
        EXieChengResponseConstant constant = EXieChengResponseConstant.OK;
        XieChengResponse response = new XieChengResponse();
        response.setMsgCode(constant.getCode());
        response.setMessage(constant.getDesc());
        return response;
    }

    public static final XieChengResponse error() {
        return error(EXieChengResponseConstant.ERROR);
    }

    public static final XieChengResponse error(EXieChengResponseConstant constant) {
        XieChengResponse response = new XieChengResponse();
        response.setMsgCode(constant.getCode());
        response.setMessage(constant.getDesc());
        return response;
    }
}
